import {get,post} from '../../utils/request'
const state={
  //用来保存查询出来的栏目信息
  accountApplys:[],
  total:0
}

const actions={
  //查询账户变动申请
  findAllAccountApply(context,list){
    console.log(list);
    for (var propName in list) { 
      if (list[propName] === null || list[propName] === undefined || list[propName]==="") {
        delete list[propName];
      }
    }
        console.log(list);
    //异步操作
    get('/accountApply/pageQueryAccountApply',list).then(res=>{
      let response=res.data.list
      context.commit('setaAcountApply',response)
      let total=res.data.total
      context.commit('setTotal',total)
    })
  },
  //审核通过
  checkPass(context,id){
    let response=get('/accountApply/checkPass',id)
    return response
  },
  //审核不通过
  checkNoPass(context,id){
    let response=get('/accountApply/checkNoPass',id)
    return response
  },
}
const mutations={
  //修改state中的值
  setaAcountApply(state,response){
    state.accountApplys=response
  },
  setTotal(state,total){
    state.total=total
  }
}

export default{
  namespaced:true,
  state,
  actions,
  mutations
}